﻿<Workspace x:Name="g7sem"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:sys="clr-namespace:System;assembly=mscorlib"
  xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib"
  xmlns="clr-namespace:agree;assembly=agree-sys"
  xmlns:cfg="clr-namespace:agree.configuration;assembly=agree-sys">

    <Workspace.DefaultDirectories>
        <StringItem>grammars</StringItem>
        <StringItem>grammars\copestake-book\itfs\g7sem</StringItem>
    </Workspace.DefaultDirectories>

    <cfg:AgreeConfig x:Name="agree_config" Loader="{cfg:LkbConfigLoader globals.lsp}" />

    <TdlGroup x:Name="agree_TdlGroup">
        <TdlGroup.TdlLetterSets>
            <LetterSet Identifier="c" Letters="bdfglmnprstz" />
            <LetterSet Identifier="s" Letters="abcdefghijklmnopqrtuvwxyz" />
            <LetterSet Identifier="a" Letters="abcdefghijklmnopqrstuvwxyz" />
            <LetterSet Identifier="t" Letters="bcdfghjklmnpqrstvwxz" />
            <LetterSet Identifier="v" Letters="aeiou" />
        </TdlGroup.TdlLetterSets>

        <Tdl Content="{ReadFile types.tdl}" />
        <Tdl Content="{ReadFile lexicon.tdl}"        TdlType="LexicalEntry" />
        <Tdl Content="{ReadFile inflr.tdl}"          TdlType="LexicalRule" />
        <Tdl Content="{ReadFile rules.tdl}"          TdlType="SyntaxRule" />
        <Tdl Content="{ReadFile lrules.tdl}"         TdlType="LexicalRule" />
        <Tdl Content="{ReadFile start.tdl}"          TdlType="StartSymbol" />
        <Tdl Content="{ReadFile parse-nodes.tdl}"    TdlType="NodeLabel" />
    </TdlGroup>

    <TdlTokenizerFactory x:Name="tok_functor" AgreeConfig="{x:Reference agree_config}" >
        <TdlTokenizerFactory.TdlLetterSets>
            <PathRef Item="{x:Reference agree_TdlGroup}" Path="TdlLetterSets" />
        </TdlTokenizerFactory.TdlLetterSets>
    </TdlTokenizerFactory>

    <Grammar x:Name="g7sem"
             AgreeConfig="{x:Reference agree_config}"
             DisplayName="Toy grammar with semantics g7sem"
             Author="Ann Copestake (2001)" />

    <TypeDictionary x:Name="agree_td" Grammar="{x:Reference g7sem}" />

    <TypeLattice x:Name="agree_bcpo">
        <TypeGraphFinalizer>
            <TypeDictionaryLoader TypeDictionary="{x:Reference agree_td}">
                <TdlConstraintGrouper TdlType="Type">
                    <TdlHashAggregator Functor="{x:Reference tok_functor}">
                        <Where x:TypeArguments="Tdl" Functor="{TdlTypePred {x:Static TdlType.Type}}">
                            <x:Reference Name="agree_TdlGroup" />
                        </Where>
                    </TdlHashAggregator>
                </TdlConstraintGrouper>
            </TypeDictionaryLoader>
        </TypeGraphFinalizer>
    </TypeLattice>

    <FeatMgr x:Name="agree_ftm" TypeLattice="{x:Reference agree_bcpo}" />

    <GlbCache x:Name="agree_glbc" FeatMgr="{x:Reference agree_ftm}" />

    <TypeUtils x:Name="agree_tu" GlbCache="{x:Reference agree_glbc}" />

    <Isometrics x:Name="agree_im" TypeUtils="{x:Reference agree_tu}" />

    <TfsUnifier x:Name="agree_u" Isometrics="{x:Reference agree_im}" />

    <EntryMgr x:Name="agree_em"
             TfsUnifier="{x:Reference agree_u}"
             FeatMgr="{x:Reference agree_ftm}"
             DefaultTokenizer="{x:Static SplitTokenizer.SpaceCharTokenizer}">

        <EntryMgr.SyntaxRuleTokenGroups>
            <TdlConstraintGrouper TdlType="SyntaxRule">
                <TdlHashAggregator Functor="{x:Reference tok_functor}">
                    <Where x:TypeArguments="Tdl" Functor="{TdlTypePred {x:Static TdlType.SyntaxRule}}" >
                        <x:Reference Name="agree_TdlGroup" />
                    </Where>
                </TdlHashAggregator>
            </TdlConstraintGrouper>
        </EntryMgr.SyntaxRuleTokenGroups>

        <EntryMgr.LexicalRuleTokenGroups>
            <TdlConstraintGrouper TdlType="LexicalRule">
                <TdlHashAggregator Functor="{x:Reference tok_functor}">
                    <Where x:TypeArguments="Tdl" Functor="{TdlTypePred {x:Static TdlType.LexicalRule}}">
                        <x:Reference Name="agree_TdlGroup" />
                    </Where>
                </TdlHashAggregator>
            </TdlConstraintGrouper>
        </EntryMgr.LexicalRuleTokenGroups>

        <EntryMgr.LexicalEntryTokenGroups>
            <TdlConstraintGrouper TdlType="LexicalEntry">
                <TdlHashAggregator Functor="{x:Reference tok_functor}">
                    <Where x:TypeArguments="Tdl" Functor="{TdlTypePred {x:Static TdlType.LexicalEntry}}">
                        <x:Reference Name="agree_TdlGroup" />
                    </Where>
                </TdlHashAggregator>
            </TdlConstraintGrouper>
        </EntryMgr.LexicalEntryTokenGroups>

        <EntryMgr.NodeLabelTokenGroups>
            <TdlConstraintGrouper TdlType="NodeLabel">
                <TdlHashAggregator Functor="{x:Reference tok_functor}">
                    <Where x:TypeArguments="Tdl" Functor="{TdlTypePred {x:Static TdlType.NodeLabel}}">
                        <x:Reference Name="agree_TdlGroup" />
                    </Where>
                </TdlHashAggregator>
            </TdlConstraintGrouper>
        </EntryMgr.NodeLabelTokenGroups>

        <EntryMgr.StartSymbolTokenGroups>
            <TdlConstraintGrouper TdlType="StartSymbol">
                <TdlHashAggregator Functor="{x:Reference tok_functor}">
                    <Where x:TypeArguments="Tdl" Functor="{TdlTypePred {x:Static TdlType.StartSymbol}}">
                        <x:Reference Name="agree_TdlGroup" />
                    </Where>
                </TdlHashAggregator>
            </TdlConstraintGrouper>
        </EntryMgr.StartSymbolTokenGroups>
    </EntryMgr>

    <NodeLabeler x:Name="agree_nl"
                 EntryMgr="{x:Reference agree_em}"
                 TfsUnifier="{x:Reference agree_u}" />

    <MorphologyRules x:Name="agree_mph" EntryMgr="{x:Reference agree_em}" />

    <Lexicon x:Name="agree_lex"
             EntryMgr="{x:Reference agree_em}"
             MorphologyRules="{x:Reference agree_mph}" />

    <StringCorpus x:Name="test_sentences">
        <StringItem>this dog chased the cat</StringItem>
        <StringItem>this dog chased the cats</StringItem>
        <StringItem>this dog chases the cat</StringItem>
        <StringItem>this dog chases the cats</StringItem>
    </StringCorpus>

    <Sequence x:Name="batch_parse">

        <x:Reference Name="test_sentences" />

        <WhitespaceSplitterF />

        <Factory x:TypeArguments="MorphologyExecutor">
            <Setter Property="{x:Static P.Lexicon}" Value="{x:Reference agree_lex}" />
            <Setter Property="{x:Static P.TfsUnifier}" Value="{x:Reference agree_u}" />
        </Factory>

        <Factory x:TypeArguments="FindChartobjCoverage" />

        <Factory x:TypeArguments="ParseControl">
            <Setter Property="{x:Static P.AgreeConfig}" Value="{x:Reference agree_config}" />
            <Setter Property="{x:Static P.ChartConfig}" Value="{PathRef {x:Reference agree_config}, Parser.Chart}" />
            <Setter Property="{x:Static P.TfsUnifier}" Value="{x:Reference agree_u}" />
            <Setter Property="{x:Static P.ChartStartSymbols}" Value="{PathRef {x:Reference agree_em}, ParserStartSymbols}" />
        </Factory>

        <Factory x:TypeArguments="UnpackLoader">
            <Setter Property="{x:Static P.TfsUnifier}" Value="{x:Reference agree_u}" />
        </Factory>

    </Sequence>

</Workspace>
